/* This Genie puts a decorative border around a box. You will need a box containing a clip or bitmap for the corners, and one or more similar boxes for the sides. The resulting border consists of a group of individual boxes, which can be moved together if you hold down the shift key.
Written by Don Cox July '92 */
address command
signal on error
signal on syntax
signal on halt
signal on break_c
signal on break_d
signal on break_e
rad = 3.1415926 / 180
call ppm_AutoUpdate(0)
call SafeEndEdit.rexx()
cr="0a"x
if ~show('l', "gdarexxsupport.library") then
if ~addlib("gdarexxsupport.library",0,-30) then
call exit_msg("Please install the gdarexxsupport.library in your libs: directory before running this Genie")
CurrentUnits = ppm_GetUnits()
select
when CurrentUnits = 1 then units="inches"
when CurrentUnits = 2 then units="millimetres"
otherwise units ="points"
end
mainbox = ppm_ClickOnBox("Click on box to be given a border")
if box=0 then exit_msg("No box selected")
mainpos = ppm_GetBoxPosition(mainbox)
mainXpos = word(mainpos, 1)
mainYpos = word(mainpos, 2)
mainsize = ppm_GetBoxSize(mainbox)
mainangle = ppm_GetBoxAngle(mainbox)
breadth = ppm_GetUserText(6, "Width of border in "units)
if breadth="" then exit_msg("Aborted by User")
if CurrentUnits = 2 then breadth = breadth/10 /* mm to cm */
if CurrentUnits = 3 then breadth = breadth/12 /* points to picas */
mainheight = (word(mainsize, 2))-(breadth*2)
mainwidth = (word(mainsize, 1))-(breadth*2)
cornerbox = ppm_ClickOnBox("Click on Box for Corner Units")
if cornerbox ~=0 then do
csize = ppm_GetBoxSize(cornerbox)
cXsize = word(csize, 1)
cYsize = word(csize, 2)
cscale = ppm_GetBoxScale(cornerbox)
cscaleX = word(cscale, 1)
cscaleY = word(cscale, 2)
cangle = ppm_GetBoxAngle(cornerbox)
end
counter=0
do forever
box=ppm_ClickOnBox("Click on boxes for side units")
if box=0 then break
counter=counter+1
boxes.counter=box
call ppm_SetBoxAngle(box,0)
if counter = 5 then break
end
sideboxes = counter /* This is the number of different units in the design */
do while counter<6
counter = counter+1
boxes.counter = boxes.1 /* pad up to 5 */
end
if Sideboxes>1 then do
pattern = ppm_GetUserText(Sideboxes*3, Sideboxes" boxes selected. Type in repeat pattern using abBAc etc.")